<layout name='Layout/layout_main' />
<script type="text/javascript" src="__PUBLIC__/editor/kindeditor.js"></script>
<script type="text/javascript" src="__PUBLIC__/editor/kindeditor.setting.js"></script>
<script type="text/javascript">
	function popup_actor(){
		winopen("{:U("popup/actor")}",800,574);
	}
	function save() {
		editor.sync();
		$("#actor").val("");
		$("#actor_wrap div.address_list span").each(function() {
			$("#actor").val($("#actor").val() + $(this).text().replace(';', '') + '|' + $(this).attr("title") + ";")
		})
		if (check_form("form_data")) {			
			sendForm("form_data", "{:U('save')}");
		}
	}

	$(document).ready(function() {
		editor_init();
		
		fill_time("start_time");
		fill_time("end_time");

		$(function() {
			$(".input-date").datepicker();
			$("#priority").val(3);
			$("#slider-range-priority").slider({
				range : "min",
				min : 1,
				max : 5,
				value : 3,
				slide : function(event, ui) {
					$("#priority").val(ui.value);
					$("div.slider_box div.ui-slider").css( "background-color", schedule_bg(ui.value));
					$("div.slider_box div.ui-widget-header").css("background-color", schedule_bg(ui.value));
				}
			});
			$("div.slider_box div.ui-slider").css( "background-color", schedule_bg(3));
			$("div.slider_box div.ui-widget-header").css("background-color", schedule_bg(3));
		})
	});
	function month_view() {
		window.open("__URL__", "_self");
	}
</script>

<div class="schedule">
	<div class="row-fluid title">
		<span>新建事项</span>
	</div>
	<form method='post' id="form_data" name="form_data" enctype="multipart/form-data">
		<input type="hidden" id="ajax" name="ajax" value="0">
		<input type="hidden" id="add_file" name="add_file">
		<input type="hidden" id="opmode" name="opmode" value="add">
		<input type="hidden" name="actor" id="actor" style="width:30px;">
		<div class="row-fluid form_box">
			<div class="row-fluid form-horizontal">
				<div class="control-group">
					<label class="control-label" for="name">主题：</label>
					<div class="controls">
						<input type="text" id="name" name="name" class="span12"  check="require" msg="请输入主题"></div>
				</div>
			</div>
			<div class="row-fluid form-horizontal">
				<div class="control-group span6">
					<label class="control-label" for="start_date">开始时间：</label>
					<div class="controls">
						<input type="text" id="start_date" name="start_date" readonly="readonly" class="input-date"   check="require" msg="请输入开始日期">
						<select id="start_time" name="start_time" class="input-small"></select>
					</div>
				</div>
				<div class="control-group span6">
					<label class="control-label" for="end_date">结束时间：</label>
					<div class="controls">
						<input type="text" id="end_date" name="end_date" readonly="readonly" 
						class="input-date"  check="require" msg="请输入结束日期">
						<select id="end_time" name="end_time" class="input-small"></select>
					</div>
				</div>
			</div>
			<div class="row-fluid form-horizontal">
				<div class="control-group span6">
					<label class="control-label" for="location">地点：</label>
					<div class="controls">
						<input type="text" id="location" name="location"></div>
				</div>
				<div class="control-group span6">
					<label class="control-label" for="priority">优先级：</label>
					<div class="controls">
						<input type="hidden" id="priority" name="priority"/>
						<div  class="slider_box" >
							<div class="left" style="padding-right:12px">低</div>
							<div id="slider-range-priority"></div>
							<div class="left"  style="padding-left:12px">高</div>
						</div>
					</div>
				</div>
			</div>
			<div class="row-fluid form-horizontal">
				<div class="control-group">
					<label class="control-label" for="name">参与人员：</label>
					<div class="controls" id="actor_wrap">
						<div class="address_list"></div>
						<input type="button" value="选择" onclick="popup_actor();" class="btn" >
						</div>
				</div>
			</div>
			<div class="row-fluid form-horizontal">
				<div class="control-group">
					<label class="control-label" for="name">附件：</label>
					<div class="controls">
						<include file="Layout:uploader" />
					</div>
				</div>
			</div>
			<div class="row-fluid form-horizontal">
				<div class="control-group">
					<textarea id="content" name="content" style="width:100%;height:300px;"></textarea>
				</div>
			</div>
		</div>
		<div class="action">
			<input class="btn default" type="button" value="保存" onclick="save();">
			<input  class="btn" type="button" value="取消" onclick="go_return_url();"></div>
	</form>
</div>